<!--
描述：学校模块-课程类型编辑
开发人：zhaohang
开发日期：2019年11月12日
-->
<template lang="pug">
  kalix-dialog.user-add(title='修改' bizKey="classSelect" ref="kalixBizDialog" v-bind:formModel.sync="formModel" v-bind:targetURL="targetURL" :submitBefore="submitBefore")
    div.el-form(slot="dialogFormSlot")
      el-form-item(label="名称" prop="selectName" v-bind:label-width="labelWidth" v-bind:rules="rules.selectName")
        el-input(v-model="formModel.selectName")
      el-form-item(label="是否启用" prop="use" v-bind:label-width="labelWidth")
        el-select(v-model="temp"  placeholder="请选择是否启用")
          el-option(v-for="item in option" v-bind:key="item.value" v-bind:value="item.value" v-bind:label="item.label")
</template>

<script type="text/ecmascript-6">
  import {classSelectURL} from '../../config.toml'
  import FormModel from './model'
  export default {
    name: 'ClassSelectEdit',
    data() {
      return {
        temp: null,
        fileList: [],
        formModel: Object.assign({}, FormModel),
        labelWidth: '120px',
        rules: {
          selectName: [{required: true, message: '请输入名称', trigger: 'change'}]
        },
        option: [{
          value: true,
          label: '启用'
        }, {
          value: false,
          label: '不启用'
        }
        ],
        targetURL: classSelectURL
      }
    },
    methods: {
      submitBefore(baseDialog, callBack) {
        if (baseDialog.formModel.use === '启用') {
          this.formModel.use = 'true'
        } else {
          this.formModel.use = 'false'
        }
        this.formModel.use = this.temp
        callBack()
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
